//package com.example.kafka;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.kafka.core.KafkaTemplate;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//@Component
//@EnableScheduling
//public class Producer {
//    @Autowired
//    private KafkaTemplate<String, String> kafkaTemplate;
//
//    @Scheduled(fixedDelay=3000)//每3s执行1次
//    public void send() {
//        kafkaTemplate.send("test", "hi,kafka");
//    }
//}
//
